---
title: "Grid Template Rows"
description: "Utilities for specifying the rows in a grid layout."
---

import plugin from 'tailwindcss/lib/plugins/gridTemplateRows'
import { Variants } from '@/components/Variants'
import { Disabling } from '@/components/Disabling'

export const classes = { plugin }

## Usage

Use the `grid-rows-{n}` utilities to create grids with _n_ equally sized rows.

```html lightBlue
<template preview class="bg-white p-8">
  <div class="h-64 grid grid-rows-3 grid-flow-col gap-4">
    <div class="bg-light-blue-500 rounded-md flex items-center justify-center text-white text-2xl font-extrabold">1</div>
    <div class="bg-light-blue-500 rounded-md flex items-center justify-center text-white text-2xl font-extrabold">2</div>
    <div class="bg-light-blue-500 rounded-md flex items-center justify-center text-white text-2xl font-extrabold">3</div>
    <div class="bg-light-blue-500 rounded-md flex items-center justify-center text-white text-2xl font-extrabold">4</div>
    <div class="bg-light-blue-500 rounded-md flex items-center justify-center text-white text-2xl font-extrabold">5</div>
    <div class="bg-light-blue-500 rounded-md flex items-center justify-center text-white text-2xl font-extrabold">6</div>
    <div class="bg-light-blue-500 rounded-md flex items-center justify-center text-white text-2xl font-extrabold">7</div>
    <div class="bg-light-blue-500 rounded-md flex items-center justify-center text-white text-2xl font-extrabold">8</div>
    <div class="bg-light-blue-500 rounded-md flex items-center justify-center text-white text-2xl font-extrabold">9</div>
  </div>
</template>

<div class="h-64 grid **grid-rows-3** grid-flow-col gap-4">
  <div>1</div>
  <!-- ... -->
  <div>9</div>
</div>
```

## Responsive

To control the rows of a grid at a specific breakpoint, add a `{screen}:` prefix to any existing grid-template-rows utility. For example, use `md:grid-rows-6` to apply the `grid-rows-6` utility at only medium screen sizes and above.

```html
<div class="grid grid-rows-2 **md:grid-rows-6** ...">
  <!-- ... -->
</div>
```

For more information about Tailwind's responsive design features, check out the [Responsive Design](/docs/responsive-design) documentation.

## Customizing

By default, Tailwind includes grid-template-row utilities for creating basic grids with up to 6 equal width rows. You change, add, or remove these by customizing the `gridTemplateRows` section of your Tailwind theme config.

You have direct access to the `grid-template-rows` CSS property here so you can make your custom rows values as generic or as complicated and site-specific as you like.

```diff-js
  // tailwind.config.js
  module.exports = {
    theme: {
      extend: {
        gridTemplateRows: {
          // Simple 8 row grid
+         '8': 'repeat(8, minmax(0, 1fr))',

          // Complex site-specific row configuration
+         'layout': '200px minmax(900px, 1fr) 100px',
        }
      }
    }
  }
```

Learn more about customizing the default theme in the [theme customization documentation](/docs/theme#customizing-the-default-theme).

### Variants

<Variants plugin="gridTemplateRows" name="grid-template-rows" />

### Disabling

<Disabling plugin="gridTemplateRows" name="grid-template-rows" />
